import request from '@/utils/request.js'

//微信登录发送code接口
export const sendWeChatLoginCodeAPI = (code) => {
  return request({
    url: '/user/user/wxlogin',
    method: 'POST',
    data: { code }
  })
}

//获取用户信息接口
export const getUserInfoAPI = (id) => {
  return request({
    url: `/user/user/getuserinfo`,
    method: 'GET',
    data: { id }
  })
}

//更新用户信息接口
export const updateUserInfoAPI = ({ username, sex, age, height, weight, prefer }) => {
  return request({
    url: '/user/user/update',
    method: 'PUT',
    data: {
      username,
      sex,
      age,
      height,
      weight,
      prefer
    }
  })
}

//记录用户行为接口（点击，收藏）
export const recordUserBehaviorAPI = (userId, dishId, action) => {
  return request({
    url: `/user/actions?userId=${userId}&dishId=${dishId}&action=${action}`,
    method: 'POST',
  })
}